<script setup lang="ts">
import { HotMovieModel } from '@/api/webSite/response';
import { defineProps } from 'vue';

const { hotMovies } = defineProps<{
  hotMovies: Array<HotMovieModel>
}>();

function bgStyle(imgaeUrl: string) {
  return `background: url(${imgaeUrl});`
}

</script>

<template>
  <div class="shell">

    <div class="box" :style="bgStyle(item.cover)" v-for="item in hotMovies" :key="item.id">
      <div class="text">
        <header>
          <span class="title">
            {{ item.name }}
          </span>
          <p>{{ item.desc }}</p>
        </header>
      </div>
    </div>

  </div>
</template>

<style scoped>
.shell {
  display: flex;
  height: 100%;
}

.box {
  cursor: pointer;
  flex: 1;
  min-width: 0;
  box-shadow: -20px 0 20px 5px rgba(255, 255, 255, 0.7);
  transition: flex 0.8s;
  background-size: cover;
  background-position: center;
  display: grid;
  place-items: center;
}

.box:hover {
  flex: 10%;
}

.box:hover .text {
  animation: appear .8s forwards .3s;
}

.img1 {
  background-image: url('/public/img/home/1.jpg');
}

.img2 {
  background-image: url('/public/img/home/2.jpg');
}

.img3 {
  background-image: url('/public/img/home/3.jpg');
}

.img4 {
  background-image: url('/public/img/home/4.jpg');
}

.text {
  opacity: 0;
  color: white;
  height: 300px;
  width: 290px;
  background-color: transparent;
}

header {
  height: 73px;
  font-size: 20px;
  line-height: 65px;
  font-weight: bold;
  border-bottom: 2px solid white;
}

.title {
  display: inline-block;
  text-decoration: underline;
  text-underline-offset: 10px;
  text-decoration-thickness: 4px;
}

.text p {
  font-size: 12px;
  line-height: 25px;
}

@keyframes appear {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}
</style>
